"""
#! /usr/bin/env python
# -*- coding:utf-8 -*-
# __author__ = "SYLVANAS"
"""
import pymysql
from exercise import db_config


conn = pymysql.connect(**db_config.sql_conn_dict)

cur = conn.cursor(cursor=pymysql.cursors.DictCursor)
# # 执行存储过程查询
# cur.callproc('proc_select_city')
#
# fetch_all = cur.fetchall()
# print(fetch_all)
# SQL语句？为站位符
sql = "select * from city WHERE Population >? AND CountryCode =?"
# 含参数存储过程方法调用
cur.callproc('proc_sql', args=(100, 'AFG', sql))

fetch_all = cur.fetchall()
# print(fetch_all)
for row in fetch_all:
    print(row)
cur.close()
conn.close()

